<?php


namespace App\Http\Controllers\android\validate;


use Illuminate\Support\Facades\Validator;

class App
{
    public static function getAppAndWhite($param){
        $rules = [
            'sn'=>'required|between:11,13',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }
    
    public static function getBrand($param){
        $rules = [
            'sn'=>'required|between:11,13',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getTopic($param){
        $rules = [
            'sn'=>'required|between:11,13',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getClassify($param){
        $rules = [
            'sn'=>'required|between:11,13',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getForceDownload($param){
        $rules = [
            'sn'=>'required|between:11,13',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addAppInstall($param){
        $rules = [
            'sn'=>'required|between:11,13',
            'app'=>'required'
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
            'app.required'=>'json数据为空',

        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function updateAppInstall($param){
        $rules = [
            'sn'=>'required|between:11,13',
            'info'=>'required',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
            'info.required'=>'json数据为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addAppLog($param){
        $rules = [
            'sn'=>'required|between:11,13',
            'packageName'=>'required',
            'versionCode'=>'required',
            'createTime'=>'required'
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
            'packageName.required'=>'包名为空',
            'versionCode.required'=>'内部版本号为空',
            'createTime.required'=>'时间为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function downloadApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'package_name'=>'required',
            'app_size'=>'required|numeric',
            'sn'=>'required'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户格式不对',
            'package_name.required'=>'包名为空',
            'app_size.required'=>'应用大小为空',
            'app_size.numeric'=>'应用大小格式不对',
            'sn.required'=>'sn码为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryAllApp($param){
        $rules = [
            'sn'=>'required|between:11,13',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryPackageApp($param){
        $rules = [
            'packageName'=>'required',
            'versionCode'=>'required'
        ];
        $msg = [
            'packageName.required'=>'包名为空',
            'versionCode.required'=>'内部版本号为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function newestAppUpdate($param){
        $rules = [
            'packageName'=>'required',
            'versionCode'=>'required'
        ];
        $msg = [
            'packageName.required'=>'包名为空',
            'versionCode.required'=>'内部版本号为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function runNewApp($param){
        $rules = [
            'sn'=>'required|between:11,13',
            'app'=>'required'
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
            'app.required'=>'应用信息格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }
}